<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        margin: 0;
        padding: 100px;
        background-image: url(../images/grid.png);
      }
      .box {
        position: relative;
        width: 100px;
        height: 100px;
        background-color: red;

        /* 父元素使用透视 */
        transform-style: preserve-3d;

        transform: rotateX(-33.5deg) rotateY(45deg);
      }
      .box .item {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
      }

      .top {
        background-color: rgba(255, 0, 0, 0.4);
        transform: rotateX(90deg) translateZ(50px);
      }

      .bottom {
        background-color: rgba(0, 255, 0, 0.5);
        transform: rotateX(-90deg) translateZ(50px);
      }

      .front {
        background-color: rgba(100, 100, 100, 0.5);
        transform: translateZ(50px);
      }

      .back {
        background-color: rgba(80, 80, 80, 0.5);
        transform: rotateY(-180deg) translateZ(50px);
      }

      .left {
        background-color: rgba(215, 1, 210, 0.5);
        transform: rotateY(90deg) translateZ(50px);
      }

      .right {
        background-color: rgba(1, 1, 210, 0.5);
        transform: rotateY(-90deg) translateZ(50px);
      }
    </style>
  </head>
  <body>
    <div class="box">
      div
      <div class="item top">1</div>
      <div class="item bottom">2</div>
      <div class="item front">3</div>
      <div class="item back">4</div>
      <div class="item left">5</div>
      <div class="item right">6</div>
    </div>
  </body>
</html>
